﻿@model IEnumerable<SmsTemplates>
@{
    Layout = "_ControlPanel";
}
<div class="tn-block tnc-ctnborder" id="all">
    <div class="tnc-main">
        <div class="tnc-ctn-center">
            <h1 style="border-bottom: 0px">
                <span>短信设置</span>
            </h1>
            <div class="tn-tabs">
                <ul class="tn-tabs-nav tn-border-gray tn-border-bottom tn-helper-clearfix">
                    <li class="tn-widget-content tn-border-gray tn-border-trl tn-tabs-selected">
                        <a href="@SiteUrls.Instance().ManageSms()">
                            短信模版列表
                        </a>
                    </li>
                    <li class="tn-widget-content tn-border-gray tn-border-trl">
                        <a href="@SiteUrls.Instance().SmsSettings()">
                            短信设置
                        </a>
                    </li>
                </ul>
            </div>
            <div>
                <div class="tnc-content-manage">
                    <div class="tn-list-header">
                        <div class="tn-toolbar-area">
                            @Html.LinkButton("添加短信模版", SiteUrls.Instance()._EditManageSms(), HighlightStyles.Default, ButtonSizes.Default, IconTypes.SmallAdd, htmlAttributes: new { plugin = "dialog" })
                        </div>
                    </div>
                    <table class="tn-table-grid">
                        <tbody>
                            <tr class="tn-table-grid-header ">
                                <th class="tn-border-gray tn-border-bottom tn-text-note">
                                    短信平台
                                </th>
                                <th class="tn-border-gray tn-border-bottom tn-text-note">
                                    模版名称
                                </th>
                                <th class="tn-border-gray tn-border-bottom tn-text-note">
                                    模版内容
                                </th>
                                <th class="tn-border-gray tn-border-bottom tn-text-note">
                                    操作
                                </th>
                            </tr>
                            @if (Model != null && Model.Count() > 0)
                            {
                                foreach (var item in Model)
                                {
                                  
                                    <tr class="tn-table-grid-row" id="outbox-@item.id">
                                        <td class="tn-border-gray tn-border-bottom">
                                           @item.SmsSettingsId
                                        </td>
                                        <td class="tn-border-gray tn-border-bottom tn-width-auto">
                                           @item.TemplateName
                                        </td>
                                        <td class="tn-border-gray tn-border-bottom ">
                                            @item.TemplateValue
                                        </td>
                                        <td class="tn-border-gray tn-border-bottom tn-width-action1 tn-nowrap">
                                            
                                        </td>
                                    </tr>
                                }
                            }
                        </tbody>
                    </table>
                    @if (Model == null || Model.Count() <= 0)
                    {
                        <div class="tn-no-data">
                            现在还没有短信模版，@Html.Link("马上添加", SiteUrls.Instance()._EditManageSms(), "马上开始添加", new { plugin = "dialog" })
                        </div>
                    }
                </div>
            </div>
        </div>
    </div>
</div>
<script language="javascript" type="text/javascript">
    $(document).ready(function () {
        //设置发件箱已经发送的个数
        $("a[id^='SetOutBoxSendCount-']").click(function (e) {
            e.preventDefault();
            $.post($(this).attr("href"), function (data) {
                art.dialog.tips(data.MessageContent, 1.5, data.MessageType, function () { window.location.reload(true); });
            });
        });

        //测试发件箱是否好用
        $("a[id^='TestOutBox-']").click(function (e) {
            e.preventDefault();
            var mydialog = art.dialog.tips("正在发送测试邮件，请稍后", 10, 0);
            var timeOut = setTimeout(function () { art.dialog.tips("等待超时", 1.5, -1, function () { window.location.reload(true); }); }, 10 * 1000);
            $.post($(this).attr("href"), function (data) {
                mydialog.close();
                clearTimeout(timeOut);
                art.dialog.tips(data.MessageContent, 3, data.MessageType);
            });
        });
    });
</script>

